<?php 
session_start();
require_once("include/authen.php");
require_once("include/ui.php");

if ($_SESSION["permission"][$posScreen]["View"]=="0"){
	echo "<script>alert('".$no_permit."');</script>";
	echo "<meta http-equiv = refresh ; content = '0 ; url = mainscreen.php'>";
	exit();
}

// show header
echo headerPage("Point of Sale");
?> 
<SCRIPT src="js/jquery.numeric.js"></script>
<SCRIPT src="js/js_pos.js"></SCRIPT>  
<SCRIPT src="js/js_marquee.js"></SCRIPT>  
<script type="text/javascript"> 
    <!--
    $(function () {
        // basic version is: $('div.demo marquee').marquee() - but we're doing some sexy extras
        
        $('div.promotion marquee').marquee('pointer').mouseover(function () {
            $(this).trigger('stop');
        }).mouseout(function () {
            $(this).trigger('start');
        }).mousemove(function (event) {
            if ($(this).data('drag') == true) {
                this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
            }
        }).mousedown(function (event) {
            $(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
        }).mouseup(function () {
            $(this).data('drag', false);
        });
    });
    //-->
    </script>
<FORM name="Act" id="Act" action="" method="post"> 
<INPUT type=hidden value="add" id="mode" name="mode"> 
<INPUT type=hidden value="<?php echo $_POST['custid'];?>" id="custid" name="custid"> 
<INPUT type=hidden value="<?php echo $_POST['CustCode'];?>" id="CustCode" name="CustCode"> 
<INPUT type=hidden value="<?php echo $_POST['CustName'];?>" id="CustName" name="CustName"> 
<INPUT type=hidden value="<?php echo $_SESSION['discount'];?>" id="userDiscount" name="userDiscount"> 
 
<table width="1024" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="10" style='border-left:2px solid #facb0c;'>&nbsp;</td>
    <td width="1004" valign="top">
        <div class="content-box">
            <div Class="toolbar-box">   
                <div class="t">
                    <div class="t">
                        <div class="t"></div>
                    </div>
                 </div>
                 <div class="m">
                    <div class="toolbar">
                        <table class="toolbar">
                        <tr>
 
                            <td>
								<a href="javascript:void('0');" title="Create new customer" id="btnAddCust">
									<span class="icon_add_user"></span>Customer
								</a>
							</td>
							<td>
								<a href="javascript:void('0');" title="Credit Sale" id="btnCreditsale">
									<span class="icon_credit_sale"></span>Credit Sale
								</a>
							</td>
							
						      <td>
								<a href="pos_history.php"  title="View History" id="btnHistory">
									<span class="icon_history"></span>History
								</a>
							</td>
							<td>
								<a href="javascript:void('0');" title="Cancel Bill" id="btnBill">
									<span class="icon_cancel_bill"></span>Cancel Bill
								</a>
							</td>
                        </tr>
                        </table>
                    </div>
                      <div class="header"  style="background-image: url(images/pos.png);">
                        Point of Sale (POS)
                      </div>
                <div class="clr"></div>
                 </div>
                 <div class="b">
                    <div class="b">
                        <div class="b"></div>
                    </div>
                 </div>
            </div>
				<div class="promotion" style="padding-bottom:5px;align:center"> 
				 <marquee behavior="scroll" direction="left" scrollamount="1" width="950">
				 <p style="color:red;font-weight:bold;font-size:12px">Promotion !!! </p></marquee>
				</div>
               <div id="element-box">
                <div class="t">
					<div class="t">
						<div class="t"></div>
					</div>	
					</div>
                <div class="m">
                    <table width="100%" style="line-height:25px;" cellspacing="0" cellpadding="0" border="0">
						 <tr style="background-color:#EAEAEA;">
							<td colspan="4" style="border:1px solid #dddddd;">
								<label style="font-size:15px;font-weight:bold;color:#F09A20;">&nbsp;Customer Info</label>
							</td>
						</tr>
						<tr style="padding-top:10px;">
							<td width="15%" class="fontSearch" style="padding-left:20">Customer Type : </td>
							<td colspan="3" width="80%" align=left style="font-size:12px;color:#666" >
								<input type="radio" id="type_01" name="CustType" checked value="1">Member</input>
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								<input type="radio" id="type_01" name="CustType" value="2">Non-Member</input>
							</td>
                    </tr>		
                    <tr  id="tr_member">
                       <td width="15%" class="fontSearch" style="padding-left:20">Customer Code : </td>
							<td width="20%" align=left valign="middle" >
								<input type="text" id="Main_Cust_Code" name="Main_Cust_Code" value="<?php echo $_POST['CustCode'];?>" class="text ui-widget-content ui-corner-all" size="15" style="padding:5px;font-size:13px;color:#333"  />
								&nbsp;<img src="images/view1.png" id="btnSearchCustomer" style='cursor:pointer' title="Search Customer" border="0"/>
							</td>
							<td width="15%" class="fontSearch" style="padding-left:20" align="right">Customer Name :&nbsp;</td>
							<td width="50%" align=left valign="middle" >
								<input type="text" id="Main_Cust_Name" name="Main_Cust_Name" value="<?php echo $_POST['CustName'];?>" class="text ui-widget-content ui-corner-all" size="45" style="padding:5px;font-size:13px;color:#333"  />
								&nbsp;&nbsp;<img src="images/shopping.png" id="btnCustService" style='cursor:pointer;display:none' title="Customer Service" border="0"/>
								&nbsp;&nbsp;&nbsp;<img src="images/history.png" id="btnCustHistory"  title="Customer history" style='cursor:pointer;display:none' border="0"/>
								<!--&nbsp;&nbsp;&nbsp;<img src="images/credit_cards.png" id="btnSmartPurse"  title="Smart Purse" style='cursor:pointer;display:none' border="0"/>-->
								&nbsp;&nbsp;&nbsp;<img src="images/edit.png" id="btnEditCustomer"  title="Update Customer" style='cursor:pointer;display:none' border="0"/>
							</td>							
                    </tr>							 
						<tr>
							<td colspan="4" style="height:10px">
						</tr>
						<tr style="background-color:#EAEAEA;">
							<td colspan="4" style="border:1px solid #dddddd;">
							<label style="font-size:15px;font-weight:bold;color:#F09A20">&nbsp;Product Info</label></td>
						</tr>
                 </table>
					<div style="height:10px"></div>
					
					<table cellspacing="1" width="100%" cellpadding="0" border="0" class="fontSearch" style="padding-bottom:10px;">
						<tr>
							<td style="padding-left:10px;"><label>Type :</label></td>
							<td style="padding-left:10px;">&nbsp;<select name="cboProductType" id="cboProductType" style="width:10em;line-height:30px;padding:5px;"
								class="ui-widget ui-widget-content ui-corner-left">  </select>&nbsp;&nbsp;</td>
							<td style="padding-left:10px;">Product Name</td>
							<td style="padding-left:10px;"><select name="cboProductList" id="cboProductList" style="width:15em;padding:3px;"></select>
								<span id="load" class="nodisplay"  style="display:none;"></span>
							</td>
							<td style="padding-left:10px;">&nbsp;&nbsp;Amount</td>
							<td style="padding-left:10px;"><input type="text"  name="Amount" style="text-align:right;width:40px;padding:5px;font-size:12px;" maxlength=6  id="Amount" class="ui-widget-content ui-corner-all" /></td>
							<td >
							
							<?php  if ($_SESSION["permission"][$posScreen]["Add"]=="1") {?>
								<button id="btnAddProduct" style="font-size:12px">Add</button>
							<?php }?>
							
							</td>
						</tr>
					</table>
					
                    <table cellspacing="1" id="resultData" class=list>
                    <thead>
                       <tr>
								<th width="3%">No</th>
								<th style="display:none">ID</th>
								<th  style="display:none">TypeID</th>
								<th class="title" width="18%">Product Name</th>
								<th  class="title" width="12%" nowrap="nowrap">Category</th>
								<th  class="title" width="7%" nowrap="nowrap">Type</th>
								<th  class="title" width="5%" nowrap="nowrap">Amt</th>
								<th  class="title" width="7%" nowrap="nowrap">Unit</th>
								<th  class="title" width="7%" nowrap="nowrap">Price</th>
								<th  class="title" width="9%" nowrap="nowrap">Total</th>
								<th  class="title" width="7%" nowrap="nowrap">Discount</th>
								<th  class="title" width="7%" nowrap="nowrap">Total Net</th>
								<th  class="title" width="5%" nowrap="nowrap">..</th>			
								<th  class="title" width="5%" nowrap="nowrap">Del</th>
								<th  style="display:none">dis</th> <!-- 14 -->
								<th  style="display:none">times</th> <!-- 15 -->
                      </tr>
                    </thead>
					<tbody>
						<tr>
							<td colspan="16" align="center"><img src="images/info1.png" border="0"/></td>
						</tr>
                    </tbody>
                     <tfoot>
                         <tr>
                            <td colspan="3">
								<div class="boxfooter" style="height:20px;padding-top:2px;">
								 <div class="totalpage">Total : <span id="rowCount">0</span>&nbsp;&nbsp;rows</div>
								</div>
							</td>
							<td colspan="13" style="padding:0px;height:20px;" align="right">
								<div style="padding:0;margin:0;align:right">
				 					<table id="summaryTable" class="noclass" width="80%" align=right border="0" style="border:0px;height:10px;padding:0;margin:0;" cellspacing="3" cellpadding="2">
							 			<thead>
										<tr style="border:0px;">
											<th class="fonsummary" style="border:0px;align:left;width:70px;">Amount :</th>
											<th class="fonsummaryNum" style="border:1px solid #ffffff;"><span id="iAmount">0</span></th>
											<th  class="fonsummary" style="border:0px;align:left;width:80px;">Discount :</th>
											<th class="fonsummaryNum" style="color:red;border:1px solid #ffffff;"><span id="iDiscount">0</span></th>
											<th  class="fonsummary" style="border:0px;align:left;width:70px;">Total Net :</th>
											<th class="fonsummaryNum" style="color:blue;font-weight:bold;border:1px solid #ffffff;"><span id="iTotalNet">0</span></th>
											<th class="extra" style="border:0px;align:left;width:30px;"><img src="images/Star.png" style='cursor:pointer' class='btnExDiscount' title="Special discount" border="0" /></th>
											
										</tr>
										<thead>
									</table>
								</div>
							</td>
                         </tr>
                     </tfoot>
                    </table>
                    <br/>

					<table width="100%" style="line-height:25px;" cellspacing="0" cellpadding="0" border="0">
						<tr style="background-color:#EAEAEA;">
							<td colspan="4" style="border:1px solid #dddddd;">
								<label style="font-size:15px;font-weight:bold;color:#F09A20">&nbsp;Payment Info</label>
							<td>
						</tr>
					</table>
					<!----------------->
					<!--- Payment 1---->
					<!----------------->
					<div style="display:block;width:100%">
						<table  width="49%" style="line-height:25px;float:left;margin-top:10px;" cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td width="30%" class="fontSearch" style="padding-left:10px;padding-top:5px;">Payment Type : </td>
								<td colspan="3" width="70%" align=left style="font-size:12px;color:#666;padding-top:5px;border-right:1px solid #ccc;" >
									<input type="radio" name="PayType" checked value="1">Cash</input>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<input type="radio" name="PayType" value="2">Credit Card</input>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<input type="radio" name="PayType" value="3">Coupon</input>
								</td>
							</tr>
							<tr>
						   <td  class="fontSearch" style="padding-left:10px">Payment Amounts : </td>
								<td colspan="3" align=left valign="middle"  style='border-right:1px solid #ccc'>
									<input type="text" id="txtPayAmt" name="txtPayAmt" value="0" class="text ui-widget-content ui-corner-all" size="45"  style="padding:5px;font-size:14px;color:blue;font-family: Tahoma, Verdana;"  />
								</td>
							</tr>	
							<tr id="tr_change" >
								<td width="25%" class="fontSearch" style="padding-left:10px">Change Amounts : </td>
								<td colspan="3" align=left valign="middle"  style='border-right:1px solid #ccc'>
									<input type="text" id="txtChangeAmt" name="txtChangeAmt" value="0" class="text ui-widget-content ui-corner-all" size="45"  style="padding:5px;font-size:14px;color:green;font-family: Tahoma, Verdana;"  />
								</td>
							</tr>								
							<tr id="tr_cardName" style="display:none">
								<td width="25%" class="fontSearch" style="padding-left:10px"><span id="lblcardNo">Card No. : </span></td>
								<td colspan="3" align=left valign="middle"  style='border-right:1px solid #ccc'>
									<input type="text" id="txtCardNo" name="txtCardNo" value="" class="text ui-widget-content ui-corner-all" maxlength="16" size="45"  style="padding:5px;font-size:14px;color:#333;font-family: Tahoma, Verdana;"  />
								</td>
							</tr>						
							<tr id="tr_remain">
								<td width="25%" class="fontSearch" style="padding-left:10px">Remain Amounts : </td>
								<td colspan="3" align=left valign="middle" style='border-right:1px solid #ccc'>
									<input type="text" id="txtRemainAmt" name="txtRemainAmt" value="0" class="text ui-widget-content ui-corner-all" size="45"  style="padding:5px;font-size:14px;color:red;font-family: Tahoma, Verdana;" />
								</td>
							</tr>
					
						</table>
						<!----------------->
						<!--- Payment 2---->
						<!----------------->
						<table  width="48%" style="line-height:25px;float:left;margin-top:10px;" cellspacing="0" cellpadding="0" border="0">
							<tr >
								<td width="30%" class="fontSearch" style="padding-left:10px;padding-top:0px;">
									<input type='checkbox' value=1 id="IspayOther" disabled /><span style='font-weight:bold;color:blue'>Other Payment :</span> 
								</td>
								<td colspan="3" width="70%" align=left style="font-size:12px;color:#666;padding-top:5px;">
									<span class='pay2'>
									<input type="radio" name="PayType2" id='Cash2' checked value="1">Cash</input>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<input type="radio" name="PayType2" id='Card2' value="2">Credit Card</input>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<input type="radio" name="PayType2" id='Smart2' value="3">Coupon</input>
									</span>
								</td>
							</tr>
							<tr class='pay2'>
								<td width="25%" class="fontSearch" style="padding-left:10px">Payment Amounts : </td>
								<td colspan="3" align=left valign="middle" >
									<input type="text" id="txtPayAmt2" name="txtPayAmt2" value="0" class="text ui-widget-content ui-corner-all" size="45"  style="padding:5px;font-size:14px;color:blue;font-family: Tahoma, Verdana;"  />
								</td>
							</tr>	
							<tr id="tr_change2" class='pay2'>
								<td  class="fontSearch" style="padding-left:10px">Change Amounts : </td>
								<td colspan="3" align=left valign="middle" >
									<input type="text" id="txtChangeAmt2" name="txtChangeAmt2" value="0" class="text ui-widget-content ui-corner-all" size="45"  style="padding:5px;font-size:14px;color:green;font-family: Tahoma, Verdana;"  />
								</td>
							</tr>								
							<tr id="tr_cardName2" class='pay2' style="display:none">
								<td  class="fontSearch" style="padding-left:10px"><span id="lblcardNo2">Card No. : </span></td>
								<td colspan="3" align=left valign="middle" >
									<input type="text" id="txtCardNo2" name="txtCardNo2" value="" class="text ui-widget-content ui-corner-all" maxlength="16"  size="45"  style="padding:5px;font-size:14px;color:#333;font-family: Tahoma, Verdana;"  />
								</td>
							</tr>						
							<tr id="tr_remain2" class='pay2'>
								<td  class="fontSearch" style="padding-left:10px">Remain Amounts : </td>
								<td colspan="3" align=left valign="middle" >
									<input type="text" id="txtRemainAmt2" name="txtRemainAmt2" value="0" class="text ui-widget-content ui-corner-all" size="45"  style="padding:5px;font-size:14px;color:red;font-family: Tahoma, Verdana;" />
								</td>
							</tr>
						</table>	
				  
				   	<table width="100%" style="line-height:25px;padding-top:10px;" cellspacing="0" cellpadding="0" border="0">
						<tr style="background-color:#EAEAEA;">
							<td  colspan="4" style="border:1px solid #dddddd;">
								<label style="font-size:15px;font-weight:bold;color:#F09A20">&nbsp;Commission</label>
							<td>
						</tr>
						<tr>
   								<td width="120px"  class="fontSearch" style="padding-left:10px">Commission : </td>
								<td colspan="3" align=left valign="middle"  style='border-right:1px solid #ccc'>
									<select name="cbouser" id="cbouser" style="width:10em;line-height:30px;padding:5px;"
								class="ui-widget ui-widget-content ui-corner-left">  </select>
								</td>
						</tr>
					</table>     					
						<table border="0" width="100%" cellspacing="0" cellpadding="0">
						<tr>
							<td align='center'>
								<div id="dashboard-buttons" style="border:0px solid #ccc;width:320px;">
								<ul>
								<li>
									<a href="javascript:void('0');" class="Save" title="SAVE">
									</a>
								</li>
 								<li>
									<a href="javascript:void('0');" class="Abort" title="CANCEL">
									</a>
								</li>
								</ul>
								</div>
								<div class="clr"></div>
							</td>
						</tr>
						</table>
					</div>
				    <div class="clr"></div>
	 
					</div>
                  <div class="clr"></div>
                </div>
                 <div class="b"><div class="b"><div class="b"></div></div></div>
                 <div class="clr"></div>
                </div> <!-- elementbox-->
     
    </td>
    <td width="10" style="border-right:2px solid #facb0c;">&nbsp;</td>
 
  </tr>
</table>
 </FORM>
 
 
<div id="dialog-form"  style="height:450px">
<p class="validateTips">Please input at least one condition.</p>
<form>
	<table cellpadding="0" cellspacing="0" border="0" width="100%" class="fieldset">
		<tr>
			<td width="25%" style="padding-left:20px;"><label for="name" >Customer Code :</label></td>
			<td colspan="2"><input type="text" name="tx      tCustCode"  id="txtCustCode" class="text ui-widget-content ui-corner-all" maxlength="20" style="width:10em;padding:.5em;font-size:12px;margin-bottom:5px;" /></td>
		</tr>
		<tr>
			<td width="25%" style="padding-left:20px"><label for="name" >Customer Name :</label></td>
			<td  colspan="2"><input type="text" maxlength name="txtCustName" style="width:15em;padding:.5em;font-size:12px;margin-bottom:5px;"id="txtCustName" class="text ui-widget-content ui-corner-all" /></td>
		</tr>
		<tr>
			<td width="25%" style="padding-left:20px"><label for="name" >Card No. :</label></td>
			<td><input type="text" name="txtCardID" style="width:15em;padding:.5em;font-size:12px;"id="txtCardID" class="text ui-widget-content ui-corner-all" /></td>
			<td><button id="btndlgSearch" style="font-size:12px">Search</button></td>
		</tr>
		<tr><td colspan="3">
			<table id="tbSearchCust" cellspacing="1" width="100%" cellpadding="3" border="0" style="font-family:Arial;background-color:#f9f9f9;font-size:11px;border:1px solid #EAEAEA;">
				<thead>
					<tr style="background-color:#CCC;font-weight:normal;">
						<th width="5%">No.</th>
						<th style="display:none">id</th>
						<th width="15%">Code</th>
						<th width="25%">Name</th>
						<th width="10%">BrithDay</th>
						<th width="15%">Card No.</th>
						<th width="10%">Telephone</th>
						<th width="15%">Lasted Access</th>
						<th width="5%">Select</th>
					</tr>
				</thead>
				<tbody style="font-weight:normal;background-color:#fff">
				</tbody>
				<tfoot>
					<tr>
						<td colspan="8" align="left" style="font-size:11px;font-weight:bold;">Count(s): <span id='iCount' style="color:red">0</span></td>
					</tr>
				</tfoot>
			</table>
		</td></tr>
	</table>
</form>
</div>
<div id="dialog-confirm" title="Confirm delete?" style="padding-top:20px;">
	<p style="font-size:13px"><span class="ui-icon ui-icon-alert" 	style="float:left; margin:0 7px 20px 0;">
		</span>Are you sure this product ?</p>
</div>

<div id="dialog-special" title="Confirm special discount?" style="margin-top:10px">
	<table width="95%" cellspacing="3">
		<tr>	
		<td width="24"><img src="images/info1.png" width="32" height="32"/></td>
		<td align="left" style="padding-left:10px">
			<span id="discountInform" style="font-size:12px;color:#999;font-weight:normal;margin-bottom:5px;">
			Discount
			</span>
		</td>
		</tr>
	</table>
	<!--p><img src="images/info.gif" width="24" height="24"/>
	<span id="discountInform" style="font-size:12px;margin-bottom:5px;">Alhoa</span></p-->
</div>


<div id="dialog-alert" title="Information" style="height:350">
	<table width="98%" cellspacing="3">
		<tr><td height="5px">&nbsp;</td></tr>
		<tr><td height="10px"><b>Customer :</b> &nbsp;<span id="customerServiceName" style="font-weight:normal;font-size:12px;"></span></td></tr>
		<tr>	
		<td align="left">
			<span id="spInfo" style="font-size:13px;color:#333;font-weight:normal;margin-top:5px;margin-bottom:10px;margin-left:10px;"></span>
		</td>
		</tr>
		<tr>
			<td>
				<table id="tbCourse" cellspacing="1" width="100%" cellpadding="3" border="0" 
					style="font-family:Arial;background-color:#f9f9f9;font-size:11px;border:1px solid #EAEAEA;">
					<thead>
					<tr style="background-color:#CCC;font-weight:normal;">
						<th width="5%">No.</th>
						<th width="75%">Course</th>
						<th width="10%">Remain</th>
						<th width="10%">Expire Date</th>
					</tr>
					</thead>
					<tbody style="font-weight:normal;background-color:#fff">
					</tbody>
 				</table>
			</td>
		</tr>
	</table>
</div>

<?php 
include ('addCustomer.html');
include ('addDiscount.php');
include ('smartpurse.php');

 echo footer();?>
